package com.sskj.gocoin.p.activity;

import com.lzy.okgo.OkGo;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.gocoin.common.Constants;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.CustomListBean;
import com.sskj.gocoin.m.bean.HaiPageBean;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.http.JsonConverter;
import com.sskj.gocoin.p.base.BasePresenter;
import com.sskj.gocoin.v.activity.CustomActivity;

import java.util.List;

import io.reactivex.Flowable;

public class CustomPresenter extends BasePresenter<CustomActivity> {
    public Flowable<List<CustomListBean>> loadData(int page) {
        return OkGo.<HttpData<HaiPageBean<CustomListBean>>>post(HttpConfig.BASE_URL+HttpConfig.AGENT_COSTUM)
                .params("act", "customer")
                .params("p", page)
                .params("size", Constants.PAGE_SIZE)
                .converter(new JsonConverter<HttpData<HaiPageBean<CustomListBean>>>() {})
                .adapt(new FlowableBody<>())
               .map(haiPageBeanHttpData -> haiPageBeanHttpData.getData().getRes());

    }
}
